package com.googlecode.sparda.commons.io.stream.policy;

import java.io.OutputStream;

import com.googlecode.sparda.commons.io.stream.ManagedOutputStream;
import com.googlecode.sparda.commons.io.stream.OutputStreamManager;

/**
 * Interface for build a policy of a {@link OutputStreamManager}.
 * @author Fabio Grucci (<i>alias</i> <b>Phoenix</b>)
 *
 */
public interface ClosingManagedOutputStreamPolicy {
	/**
	 * Method called by a {@link ManagedOutputStream} to notify the opening of a stream.
	 * @param openedStream The opened stream
	 */
	public void notifyOpen(ManagedOutputStream<? extends OutputStream> openedStream);
	/**
	 * Method called by a {@link ManagedOutputStream} to notify the temporary closure of a stream.
	 * @param temporaryClosedStream The temporary closed stream
	 */
	public void notifyTemporaryClosed(ManagedOutputStream<? extends OutputStream> temporaryClosedStream);
	/**
	 * Method called by a {@link ManagedOutputStream} to notify the definitely closure of a stream.
	 * @param closedStream The definitely closed stream
	 */
	public void notifyDefinitelyClosed(ManagedOutputStream<? extends OutputStream> closedStream);
	/**
	 * Method called by a {@link ManagedOutputStream} to notify the the creation of a stream.
	 * @param newStream The created stream
	 */
	public void notifyNewManagedOutputStream(ManagedOutputStream<? extends OutputStream> newStream);
	/**
	 * Method called by a {@link ManagedOutputStream} to get the stream to close.
	 * @return An open {@link ManagedOutputStream} to close
	 */
	public ManagedOutputStream<? extends OutputStream> getStreamToClose();
	
}
